$(function(){
	patientvisitdetail();
	function patientvisitdetail(){
		var archivesid =utilModule.getQueryString("archivesid");
		var param = {"archivesid":archivesid};
		function callBack(data){
			console.log(data);
			var json = data.patientSupplementInfo;
			if(utilModule.checkUndefined(json)!="") {
			$(".supplementName").text(json.gname);
			$(".supplementRelation").text(json.grelation);
			$(".supplementPhone").text(json.gphone);
			$(".supplementAddress").text(json.gaddress);
			$(".contactname").text(json.contactname);
			$(".contactphone").text(json.contactphone);
			var hb=["城镇","农村"]
			$(".usertype").text(hb[json.usertype-1]);
			var jy=["在岗工人","在岗管理者","农民","下岗或无业","在校生","退休","专业技术人员","其他","不详"]
			$(".work").text(jy[json.work-1]);
			var agree=JSON.parse(json.informed)
			var t=["不同意参加管理","同意参加管理"];
			$(".informed").text(t[agree.select]);
			$(".morbidity").text(json.morbidity);
			var currentdiagnosis=JSON.parse(json.currentdiagnosis);
			var ds =["精神分裂症",'分裂感情性精神障碍',"癫痫所致精神障碍","精神发育迟滞伴发精神障碍","心境障碍","偏执型精神障碍","其他(需备注)"];
			$(".diagnosis").text(ds[currentdiagnosis.diagnosis-1]);
			$(".hospitalname").text(currentdiagnosis.hospitalname);
			$(".datetimes").text(currentdiagnosis.datetime);
			var g=["临床痊愈","好转","无变化","加重"];
			$(".effect").text(g[json.effect-1]);
			var wxRisks=JSON.parse(json.riskInfo);
			var symptom=["幻觉","交流困难","猜忌","喜怒无常","行为怪异","幸福话多","伤人毁物","悲观厌世","无故外出","自言自语","孤僻懒散","其他"]
			var wxRisk = wxRisks.select.split(",");
			for(i in wxRisk){
				if(wxRisk[i]>0&&wxRisk[i]<12){
					$(".symptom").append(parseInt(wxRisk[i])+" . "+symptom[wxRisk[i]-1]+"</br>");
				}
				if(wxRisk[i]==12){
					$(".symptom").append(parseInt(wxRisk[i])+" . "+symptom[wxRisk[i]-1]+"("+wxRisks.write+")");
				}
				
			}
			var s=["无关锁","关锁","关锁已解除"];
			$(".isbelock").text(s[json.isbelock-1]);
			var treatment=JSON.parse(json.treatment);
			var z=["未治","间断门诊治疗","连续门诊治疗"];
			$(".select").text(z[treatment.select-1]);
			$(".datetime").text(treatment.datetime);
			if(treatment.select==1){
				$(".count").parent().hide();
			}else{
				$(".count").text(treatment.count+"次");
			}
			var mqSymptoms=JSON.parse(json.symptominfo);
			var symptomsName=[];
			symptomsName["qingdu"]="轻度滋事";
			symptomsName["zhaoshi"]="肇事";
			symptomsName["zhaohuo"]="肇祸";	
			symptomsName["qita"]="其他危害行为";
			symptomsName["zishang"]="自伤";
			symptomsName["zisha"]="自杀未遂";
			symptomsName["wu"]="无";
			var li=0;
			for(i in mqSymptoms){
				li++;
				var $type = mqSymptoms[i].type;
				if(mqSymptoms[i].type==1){
					$type ="轻度滋事";
				}else if(mqSymptoms[i].type==2){
					$type ="肇事";
				}else if(mqSymptoms[i].type==3){
					$type ="肇祸";
				}else if(mqSymptoms[i].type==4){
					$type ="其他危害行为";
				}else if(mqSymptoms[i].type==5){
					$type ="自伤";
				}else if(mqSymptoms[i].type==6){
					$type ="自杀未遂";
				}else if(mqSymptoms[i].type==7){
					mqSymptoms[i].count = 0;
					$type ="无";
					
				}
				console.log($type);
				$(".mqSymptoms").append(parseInt(li)+" . "+$type+"<span class='mui-pull-right'>"+mqSymptoms[i].count+"次</span></br>");
			}
			var j=["贫困，在当地贫困线标准以下","非贫困"]
			$(".economic").text(j[json.economic-1]);
			$(".opinion").text(json.opinion);
			}
		}
		electronicArchivesMdule.severePatientTable(param,callBack);
	}
	$(".html-loding").hide();
});
